{include file="public/header" /}
<body class="hide-top bgc">
<div class="submit-container">
    <img src="/static/index/img/icon55.png" alt="">
    <div class="submit-content">
        <div class="submit-hd flex-center">
            <i class="layui-icon layui-icon-left" onclick="goBack()"></i>确认订单
        </div>
        <form method="post" class="form layui-form">
            <input type="hidden" name="address_id" id="address_id" value='{$temporary.address?$temporary.address.id:""}'>
            <div class="submit-site flex-layout">
                {if $temporary.address}
                <div class="choice_address">
                    <div>
                        <img src="/static/index/img/icon56.png" alt="">{$temporary.address.nickname}
                        {$temporary.address.tel}
                    </div>
                    <p>{$temporary.address.address}</p>
                </div>
                <i class="layui-icon layui-icon-right"></i>
                {else}
                <div  class="add_address" style="display: flex;justify-content: space-between;align-items: center;width: 100%">
                    <div>请添加收货地址</div>
                    <i class="layui-icon layui-icon-right"></i>
                </div>
                {/if}
            </div>
            <div class="submit-pro">
                <ul class="submit-pro-list">
                    {foreach name="temporary.product" item="product"}
                    <li>
                        <p class="flex-center">
                            <img src="{$product.icon}" alt="">
                        </p>
                        <div class="center">
                            <p class="multi">{$product.title}</p>
                            <p class="spec">{$product.spec}</p>
                        </div>
                        <div class="rgt">
                            <p class="price">￥<span>{$product.vip_price}</span></p>
                            <p>x{$product.num}</p>
                        </div>
                    </li>
                    {/foreach}
                </ul>
                <ul class="submit-pro-form">
                    <li>买家留言：
                        <input type="text" name="remark" placeholder="选填，输入内容请和卖家协商确认">
                    </li>
                </ul>
            </div>
        </form>
    </div>
</div>
<div class="submit-footer">
    <div>
        <p>合计：<span>￥{$temporary.amount}</span></p>
    </div>
    <p class="flex-center submitOrder">提交订单</p>
</div>
</body>
{include file="public/footer" /}
<script>
    $(function () {
        $('.submitOrder').click(function () {
            var address_id = $('#address_id').val();
            if (!address_id) {
                layer.msg('请选择收货地址');
                return false;
            }
            _ajax("{:url('order/submit')}", $('.form').serialize())
        });
        $('.add_address').click(function () {
            location.href = "{:url('address/add')}?type=add";
        });
        $('.choice_address').click(function () {
            layer.open({
                type: 2,
                offset: 'b',
                anim: 'slideUp', // 从下往上
                title: '请选择收货地址',
                shadeClose: true,
                shade: 0.8,
                area: ['100%', '80%'],
                content: '{:url(\'address/index\')}?tpl=choice' //iframe的url
            });
        });
    });
</script>
</html>